package com.ai.entity.function;

import com.ai.entity.BasePage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.util.StringUtils;

@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class FunctionPage extends BasePage<FunctionPO> {

    private String nickname;
    private Integer type;

    @Override
    public QueryWrapper<FunctionPO> getQuery(QueryWrapper<FunctionPO> queryWrapper) {
        return super.getQuery(queryWrapper)
                .like((!StringUtils.isEmpty(nickname)), "nickname", nickname)
                .eq((type != null && type != 0), "type", type)
                .eq("state", 1);
    }
}
